package com.icodingedu.springcloud.controller;

import com.icodingedu.springcloud.pojo.PortInfo;
import com.icodingedu.springcloud.service.IService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
public class FeignController {

    @Autowired
    private IService service;

    @GetMapping("/sayhi")
    public String sayHi(){
        return service.sayHello();
    }

    @PostMapping("/sayhi")
    public PortInfo sayHi(@RequestBody PortInfo portInfo){
        return service.sayHello(portInfo);
    }

    @GetMapping("/retry")
    public String retry(@RequestParam(name="timeout") int timeout){
        return service.retry(timeout);
    }
}
